package com.appkubes.mall.restful.application.system.config.controller;

import com.appkubes.common.Response;
import com.appkubes.mall.restful.application.common.base.BaseController;
import com.appkubes.mall.restful.application.system.config.service.ConfigGlobalService;
import com.appkubes.mall.restful.application.system.config.service.impl.ConfigGlobalEnum;
import com.appkubes.mall.restful.application.system.config.service.impl.ConfigServiceImpl;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@Api("系统配置模块")
@RestController
@RequestMapping({"/config", "/saas_credit/Psystem"})
public class ConfigController extends BaseController {

    @Autowired
    ConfigServiceImpl configServiceImpl;

    @Autowired
    ConfigGlobalService configGlobalService;

    @ApiOperation("获取客服")
    @PostMapping("/getContact")
    public Response getContact() {
        return Response.success(configServiceImpl.getByKey("systemhotline", ""));
    }

    @ApiOperation("test")
    @GetMapping("/test")
    public String test() {
        return configGlobalService.getConfigValue(ConfigGlobalEnum.PAYMENT_DEV);
    }


    @ApiOperation("获取运费")
    @PostMapping("/getDeliveryFee")
    public Response getDeliveryFee() {
        return Response.success(configServiceImpl.getByKey("systemdeliveryfee", ""));
    }
}
